import QtQuick 2.1
import QtQuick.Controls 1.1



StackView {
    width: parent.width
    height: parent.height

    property alias recordDescText: savePage.recordDescText

    function popStackPage(key)
    {
        if ((key === Qt.Key_Back)||(key ===Qt.Key_Escape)) {
            if (settingsView.depth > 1) {
                settingsView.pop();
            } else { Qt.quit(); }
        }
    }

    Item{
        visible:false
        ChoosePage{id: choosePage}
    }

    Item{
        visible:false
        SavePage{id: savePage}
    }

    Item{
        visible:false
        FilterSettingsPage{id: filterSettings}
    }

    Item{
        visible:false
        PlotSettingsPage{id: plotSettings}
    }


     Item{
        id:stackRoot
        width: parent.width
        height: parent.height
        ListView {
            interactive: false
            width: parent.width
            height: parent.height
            model: SettingsModel{}

            delegate: ListDelegat {
                onClicked:
                    switch(title)
                    {
                    case "Choose Channel":
                        settingsView.push({item:choosePage,destroyOnPop:false});
                        break;

                    case "Filter Options":
                        settingsView.push({item:filterSettings,destroyOnPop:false});
                        break;

                    case "Plot Options":
                        settingsView.push({item:plotSettings,destroyOnPop:false});
                        break;

                    case "Save Options":
                        settingsView.push({item:savePage,destroyOnPop:false});
                        break;

                    case "Exit":
                        Qt.quit();
                        break;

                    default:

                    }
            }
        }
    }

     initialItem:stackRoot
}





